package com.nf.sms.entity;

import java.util.Date;

/**
 * 实体对象 - 与数据表进行一一对应（映射）
 *
 * 也就是说，数据库中存在多少个数据表，则在项目中就存在多少个实体对象
 *
 * 作用：封装数据 + 传递数据
 *
 * 实现：
 *  1)类中的属性与表中的字段进行一一对应
 *  2)私有化属性
 *  3)setter/getter方法
 *  4)根据需要，重载构造方法 - "必须"存在一个默认构造方法
 *
 * @author ZQX
 * @date 2024-10-10
 */
public class User {
    private int id ;
    private String username ;
    private String password ;
    private String level ;
    private String image ;
    private String phone ;
    private String email  ;
    private Date registerTime;
    private int status ;

    // 默认构造方法
    public User() {
    }

    // 重载构造方法 - 在实例化对象时，初始化对象
    public User(int id, String username, String password, String level, String image, String phone, String email, Date registerTime, int status) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.level = level;
        this.image = image;
        this.phone = phone;
        this.email = email;
        this.registerTime = registerTime;
        this.status = status;
    }

    // alt + insert(Ins)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", level='" + level + '\'' +
                ", image='" + image + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", registerTime=" + registerTime +
                ", status=" + status +
                '}';
    }
}
